let fmdata = (val)=>{
	var date = new Date(Number(val)); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	var Y = date.getFullYear();
	var M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) ;
	var D = date.getDate();
	let obj={
		Y:Y,
		M:M,
		D:D,
		date:`${Y}-${M}-${D}`
	}
	return obj;
}
const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()
  let obj={
	  Y:year,
	  M:`${month}月`,
	  D:day,
	  hm:`${hour}:${minute}`
  }
  // return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
  return obj;
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}



export default {
	fmdata,
	formatTime:formatTime
}
